package com.demo.java.netty.hello;

import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;

import java.util.concurrent.Executors;

public class FutureCallbackTest {

    public static void main(String[] args) {
        final ListeningExecutorService listeningExecutorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5));
        final ListenableFuture<?> listenableFuture = listeningExecutorService.submit(() -> {
            System.out.println("running callback task, " + Thread.currentThread().getName());
        });
        listenableFuture.addListener(() -> {

        }, Executors.newSingleThreadExecutor());
    }
}
